// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import Common from "../Common";

const {ccclass, property} = cc._decorator;

@ccclass
export default class Login extends Common {

    @property(cc.Node)
    loginBtn: cc.Node;

    @property(cc.Node)
    registerBtn: cc.Node;

    @property(cc.Node)
    resetPwdBtn: cc.Node;

    @property(cc.Node)
    loginDialog: cc.Node;

    @property(cc.Node)
    registerDialog: cc.Node;

    @property(cc.Node)
    resetPwdDialog: cc.Node;

    start() {
        cc.director.preloadScene('hall')
        this.loginBtn.on(cc.Node.EventType.TOUCH_START, this.onShowLoginDialog, this)
        this.registerBtn.on(cc.Node.EventType.TOUCH_START, this.onShowRegisterDialog, this)
        this.resetPwdBtn.on(cc.Node.EventType.TOUCH_START, this.onShowRegisterDialog, this)
    }

    onShowLoginDialog(e) {
        this.onBtnClick()
        this.loginDialog.active = true
    }

    onShowRegisterDialog(e) {
        this.onBtnClick()
        this.registerDialog.active = true
    }

    onShowResetPwdDialog(e) {
        this.onBtnClick()
        this.resetPwdDialog.active = true
    }

    // update (dt) {}
}
